package com.ruoyi.project.poem.guesssubject.service.impl;

import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.framework.aspectj.lang.annotation.DataSource;
import com.ruoyi.framework.aspectj.lang.enums.DataSourceType;
import com.ruoyi.project.poem.guesssubject.domain.GuessSubject;
import com.ruoyi.project.poem.guesssubject.mapper.GuessSubjectMapper;
import com.ruoyi.project.poem.guesssubject.service.IGuessSubjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 猜诗题目Service业务层处理
 *
 * @author shixiangwen
 * @date 2021-02-10
 */
@Service
@DataSource(DataSourceType.POEM)
public class GuessSubjectServiceImpl implements IGuessSubjectService {
    @Autowired
    private GuessSubjectMapper guessSubjectMapper;

    /**
     * 查询猜诗题目
     *
     * @param id 猜诗题目ID
     * @return 猜诗题目
     */
    @Override
    public GuessSubject selectGuessSubjectById(Long id) {
        return guessSubjectMapper.selectGuessSubjectById(id);
    }

    /**
     * 查询猜诗题目列表
     *
     * @param guessSubject 猜诗题目
     * @return 猜诗题目
     */
    @Override
    public List<GuessSubject> selectGuessSubjectList(GuessSubject guessSubject) {
        return guessSubjectMapper.selectGuessSubjectList(guessSubject);
    }

    /**
     * 新增猜诗题目
     *
     * @param guessSubject 猜诗题目
     * @return 结果
     */
    @Override
    public int insertGuessSubject(GuessSubject guessSubject) {
        return guessSubjectMapper.insertGuessSubject(guessSubject);
    }

    /**
     * 修改猜诗题目
     *
     * @param guessSubject 猜诗题目
     * @return 结果
     */
    @Override
    public int updateGuessSubject(GuessSubject guessSubject) {
        return guessSubjectMapper.updateGuessSubject(guessSubject);
    }

    /**
     * 删除猜诗题目对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteGuessSubjectByIds(String ids) {
        return guessSubjectMapper.deleteGuessSubjectByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除猜诗题目信息
     *
     * @param id 猜诗题目ID
     * @return 结果
     */
    @Override
    public int deleteGuessSubjectById(Long id) {
        return guessSubjectMapper.deleteGuessSubjectById(id);
    }
}
